<template>
  <div class="app-container">
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="订单编号">
        <el-input placeholder="请输入订单号" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSearch">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      v-loading="listLoading"
      :data="tableData"
      style="width: 100%"
      border
      fit
      highlight-current-row
    >
      <el-table-column
        prop="name"
        label="订单编号"
      />
      <el-table-column
        prop="name"
        label="商品信息"
      />
      <el-table-column
        prop="name"
        label="下单时间"
      />
      <el-table-column
        prop="name"
        label="订单金额"
      />
      <el-table-column
        prop="name"
        label="订单状态"
      />
      <el-table-column
        prop="name"
        label="收货人"
      />
      <el-table-column
        prop="name"
        label="收货地址"
      />
      <el-table-column
        prop="name"
        label="收货手机号"
      />
      <el-table-column label="操作" width="220px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="handleSend(scope)"
          >发货</el-button>
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getCategoryList } from '@/api/goods/goodsCategory.js'
export default {
  data() {
    return {
      tableData: [],
      listLoading: true
    }
  },
  created() {
    this.getListFun()
  },
  methods: {
    getListFun() {
      getCategoryList().then(res => {
        this.listLoading = false// 列表请求结束，则把表格的loading关闭
        const { code, data } = res
        if (code === 200) {
          this.total = data.pagination.total
          this.tableData = data.list
        }
      })
    },
    onSearch() {
      console.log('search')
    },
    handleSend() {
      console.log('发货')
    },
    handleDelete() {
      console.log('删除')
    }
  }
}
</script>

<style lang="scss" scoped>
  .demo-form-inline{
   margin-top: 20px;
 }
</style>
